package com.example.freemarker;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.*;

/**
 * Created by Administrator on 2017/1/18 0018.
 */

@Controller
public class FTLController {


    @RequestMapping("/helloFtl2")
    public String helloftl2(Map<String,Object> map){
        map.put("name", "[Angel -- 守护天使]");
        map.put("name2", "Angel2");

        map.put("gender",1);//gender:性别，1：男；0：女；

        List<Map<String,Object>> friends =new ArrayList<Map<String,Object>>();
        Map<String,Object> friend = new HashMap<String,Object>();
        friend.put("name", "张三");
        friend.put("age", 20);
        friends.add(friend);
        friend = new HashMap<String,Object>();
        friend.put("name", "李四");
        friend.put("age", 22);
        friends.add(friend);
        map.put("friends", friends);


        String[] fruits= {"111","222","333"};
        map.put("fruits", fruits);

        map.put("x", 5);
        map.put("y", 4);


        return "freemarker/helloFtl2";
    }

    @RequestMapping("/helloFtl3")
    public String helloftl3(Map<String,Object> map){
        map.put("name", "[Angel -- 守护天使]");
        map.put("name2", "Angel2");

        map.put("gender",1);//gender:性别，1：男；0：女；

        List<Map<String,Object>> friends =new ArrayList<Map<String,Object>>();
        Map<String,Object> friend = new HashMap<String,Object>();
        friend.put("name", "张三");
        friend.put("age", 20);
        friends.add(friend);
        friend = new HashMap<String,Object>();
        friend.put("name", "李四");
        friend.put("age", 22);
        friends.add(friend);
        map.put("friends", friends);


        String[] fruits= {"111","222","333"};
        map.put("fruits", fruits);

        map.put("x", 5);
        map.put("y", 4);


        return "freemarker/helloFtl3";
    }


    @RequestMapping("/helloFtl4")
    public String helloftl4(Map<String,Object> map){
        map.put("name", "[Angel -- 守护天使]");
        map.put("name2", "Angel2");

        map.put("gender",1);//gender:性别，1：男；0：女；

        List<Map<String,Object>> friends =new ArrayList<Map<String,Object>>();
        Map<String,Object> friend = new HashMap<String,Object>();
        friend.put("name", "张三");
        friend.put("age", 20);
        friends.add(friend);
        friend = new HashMap<String,Object>();
        friend.put("name", "李四");
        friend.put("age", 22);
        friends.add(friend);
        map.put("friends", friends);


        String[] fruits= {"111","222","333"};
        map.put("fruits", fruits);

        map.put("x", 5);
        map.put("y", 4);
        map.put("firstName", "aa");
        map.put("maidenName","bb");
        map.put("lastName", "cc");

        return "freemarker/helloFtl4";
    }
}
